<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>FCKTools - Tests for JsUnit</title>
	<script src="../../../editor/_source/fckscriptloader.js" type="text/javascript"></script>
	<script type="text/javascript" src="tests.js"></script>
	<script type="text/javascript" src="../_jsunit/app/jsUnitCore.js"></script>
	<script type="text/javascript">

FCKScriptLoader.Load( 'FCKTools' ) ;

	</script>
	<script type="text/javascript">

function test_GetElementDocument()
{
	assertEquals(
		document,
		FCKTools.GetElementDocument( document.getElementById( '_Element' ) ) ) ;
}

function test_GetElementWindow()
{
	// In IE, the type of the returned window is different of window, but it is ok.
	if ( FCKTools.GetElementWindow( document.getElementById( '_Element' ) ) != window )
	{
		assertEquals(
			window,
			FCKTools.GetElementWindow( document.getElementById( '_Element' ) ) ) ;
	}
}

function test_GetDocumentWindow()
{
	// In IE, the type of the returned window is different of window, but it is ok.
	if ( FCKTools.GetDocumentWindow( document ) != window )
	{
		assertEquals(
			window,
			FCKTools.GetDocumentWindow( document ) ) ;
	}
}

function test_HTMLEncode()
{
	assertEquals(
		'This "is" &lt;a&gt; test: \'&amp;\'',
		FCKTools.HTMLEncode( 'This "is" <a> test: \'&\'' ) ) ;
}

function test_IsStrictMode()
{
	assertTrue(
		FCKTools.IsStrictMode( document ) ) ;
}

function test_CloneObject()
{
	var original =
	{
		Text : 'Some Text',
		Number : 10,
		ArrayObject : [ 1, 3, 5 ]
	} ;

	var clone = FCKTools.CloneObject( original ) ;

	assertEquals( 'original.Text', 'Some Text', original.Text ) ;
	assertEquals( 'original.Number', 10, original.Number ) ;
	assertEquals( 'original.ArrayObject.length', 3, original.ArrayObject.length) ;

	assertEquals( 'clone.Text', 'Some Text', clone.Text ) ;
	assertEquals( 'clone.Number', 10, clone.Number ) ;
	assertEquals( 'clone.ArrayObject.length', 3, clone.ArrayObject.length) ;

	clone.Text += ' Test' ;
	clone.Number += 15 ;
	clone.ArrayObject = new Array() ;
	clone.ArrayObject.push( 2 ) ;

	assertEquals( 'original.Text', 'Some Text', original.Text ) ;
	assertEquals( 'original.Number', 10, original.Number ) ;
	assertEquals( 'original.ArrayObject.length', 3, original.ArrayObject.length) ;

	assertEquals( 'clone.Text', 'Some Text Test', clone.Text ) ;
	assertEquals( 'clone.Number', 25, clone.Number ) ;
	assertEquals( 'clone.ArrayObject.length', 1, clone.ArrayObject.length) ;

}

	</script>
</head>
<body>
	<div id="_Element"></div>
</body>
</html>
